package 剑指offer_力扣版.Month07.day06字符串;


import java.util.Locale;

public class 有效的回文 {
    public static boolean isPalindrome(String s) {
        StringBuilder str = new StringBuilder();
        s = s.toLowerCase();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if(Character.isLetterOrDigit(c)){
                str.append(s.charAt(i));
            }
        }
        return str.toString().equals(str.reverse().toString());
    }


    public static void main(String[] args) {
        System.out.println(isPalindrome("race a car"));
    }
}
